cc.Class({
    extends: cc.Component,

    properties: {
        HPTiao: {
            default: [],
            type: [cc.Node]
        },
    },

    SetHP(HP) {
        if (HP <= 200 && HP >= 0)
            for (var i = 0; i < this.HPTiao.length; i++) {
                var element = this.HPTiao[i];
                if (i * 20 + 20 <= HP - HP % 20) {
                    element.scaleX = 1;
                }
                else if (i * 20 >= HP - HP % 20 + 20) {
                    element.scaleX = 0;
                }
                else {
                    element.scaleX = (HP % 20) / 20;
                }
            }
        else console.log("HP Set Wrong!");
    },
    // LIFE-CYCLE CALLBACKS:

    // onLoad () {},

    start () {

    },

    // update (dt) {},
});
